<?php

use app\Tools\UrlTool;
use yii\helpers\Html;
use app\assets\LayuiAsset;

LayuiAsset::register($this);

// 当前页面URL
$currentUrl = $this->context->action->uniqueId;
?>

<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body class="layui-layout-body">
<?php $this->beginBody() ?>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">RBAC管理后台</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->

        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item <?php if ($currentUrl == 'admin/index/index'): ?>layui-this<?php endif; ?>">
                <a href="/admin/index/index">首页</a>
            </li>
            <!--
            <li class="layui-nav-item"><a href="">商品管理</a></li>
            <li class="layui-nav-item"><a href="">用户</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">其它系统</a>
                <dl class="layui-nav-child">
                    <dd><a href="">邮件管理</a></dd>
                    <dd><a href="">消息管理</a></dd>
                    <dd><a href="">授权管理</a></dd>
                </dl>
            </li>
            -->
        </ul>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="http://t.cn/RCzsdCq" class="layui-nav-img">
                    <?php if (isset($this->params['current_user']['name'])): ?> <?=$this->params['current_user']['name']?> <?php endif; ?>
                    -
                    <?php if (isset($this->params['current_user']['id'])): ?> <?=$this->params['current_user']['id']?> <?php endif; ?>
                </a>
                <!--
                <dl class="layui-nav-child">
                    <dd><a href="">基本资料</a></dd>
                    <dd><a href="">安全设置</a></dd>
                </dl>
                -->
            </li>
            <li class="layui-nav-item"><a href="<?=UrlTool::createUrl('/admin/user/logout')?>">退了</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree">
                <?php if (isset($this->params['menu_list']) && !empty($this->params['menu_list'])): ?>
                <?php foreach ($this->params['menu_list'] as $menu): ?>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;"><?=$menu['title']?></a>
                    <?php if (isset($menu['child']) && !empty($menu['child'])): ?>
                    <dl class="layui-nav-child">
                        <?php foreach ($menu['child'] as $child): ?>
                        <!--layui-this-->
                        <dd class="<?php if ($currentUrl == $child['url']): ?>layui-this<?php endif; ?>">
                            <a href="<?='/' . $child['url']?>"><?=$child['title']?></a>
                        </dd>
                        <?php endforeach; ?>
                    </dl>
                    <?php endif; ?>
                </li>
                <?php endforeach; ?>
                <?php endif; ?>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <?=$content?>
        </div>
    </div>

    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>
<?php $this->endBody() ?>

</body>
</html>
<?php $this->endPage() ?>